<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="../js/vue.js"></script>
    <title>1.事件处理的基本使用.html</title>
</head>
<body>
<div id="root">
    <h2>欢迎使用{{name}}</h2>
    <button @click="welcome">欢迎(不传参)</button>
    <!--  $event可写可不写  -->
    <button @click="welcome2($event,name)">欢迎(传参)</button>
</div>

<script type="text/javascript">
    Vue.config.productionTip = false
    new Vue({
        el: "#root",
        data: {
            name: "科技园"
        },
        methods: {
            welcome(event) {
                console.log(event.target)
                alert('欢迎光临')
            },
            welcome2(event, name) {
                console.log(event, name)
            }
        }
    })
</script>
</body>
</html>